<?php
//session_start();
//$UserID = $_SESSION['ID'];
//$UserName = $_SESSION['UserName'];
//$associd = $_GET['associd'];
include_once('Mysql_connect.inc');//启动连接，连接名：$conn
$associd = 'SA6762';
    $result_m = mysqli_query($conn, "SELECT membership FROM studentassociation WHERE sa_id = '$associd' ");
    while (($row = mysqli_fetch_array($result_m, MYSQLI_ASSOC)) != NULL) {

         $membership = $row['membership'];

    }
    mysqli_free_result($result_m);
    echo $membership;
    $result_G = mysqli_query($conn,"UPDATE member 
    SET groups = '12'
    WHERE groups = '16' ,sa_id = '$associd'
");
if ($result_G) {
$Nmembership = $conn ->affected_rows + $membership;
    $result_S = mysqli_query($conn,"UPDATE studentassociation
    SET membership = '$Nmembership'
    WHERE president_id = '$UserID'");
    if($result_S){
    echo "Update success!";
    }
    else echo "The server error.";

}
else echo "No new member request.";

include_once('Mysql_unconnect.inc'); //断开连接
?>
